package cn.daichi.elasticsearchdemo.event;

import lombok.Getter;
import lombok.Setter;
import org.springframework.context.ApplicationEvent;

@Getter
@Setter
public class PostEsEvent extends ApplicationEvent {

    public static final String CREATE_OR_UPDATE = "create_update";
    public static final String REMOVE = "remove";

    private Long postId;
    private String type;

    public PostEsEvent(Long postId, String type) {
        super(String.join(":", type, postId.toString(), String.valueOf(System.currentTimeMillis())));
        this.postId = postId;
        this.type = type;
    }

}
